Conversion of a first diagram having states and transitions to a graphical data flow program using an intermediate XML representation

ABSTRACT

A system and method for programmatically generating a graphical program in response to state diagram information. The state diagram information may specify a plurality of states and state transitions, wherein each state transition specifies a transition from a first state to a second state. A graphical program generation program (GPG program), may receive the state diagram information and automatically, i.e., programmatically, generate a graphical program (or graphical program portion) based on the state diagram information.

PRIORITY CLAIM

This application is a continuation of U.S. patent application Ser. No.11/683,568, titled “Generating a Hardware Description from a GraphicalProgram in Response to Receiving a Diagram with States and StateTransitions”, filed Mar. 8, 2007, whose inventors were Jeffrey L.Kodosky and Kevin Hogan, now U.S. Pat. No. 7,818,715, which is acontinuation of U.S. patent application Ser. No. 09/747,091, titled“System and Method for Programmatically Generating a Graphical Programin Response to a State Diagram”, filed Dec. 21, 2000, whose inventorswere Jeffrey L. Kodosky and Kevin Hogan, now U.S. Pat. No. 7,200,838,which is a continuation-in-part of U.S. patent application Ser. No.09/745,023 titled “System and Method for Programmatically Generating aGraphical Program in Response to Program Information”, filed Dec. 20,2000, whose inventors were Ram Kudukoli, Robert Dye, Paul F. Austin,Lothar Wenzel, and Jeffrey L. Kodosky, now U.S. Pat. No. 7,210,117.

FIELD OF THE INVENTION

The present invention relates to the field of graphical programming, andmore particularly to a system and method for programmatically generatinga graphical program in response to state diagram information.

DESCRIPTION OF THE RELATED ART

Traditionally, high level text-based programming languages have beenused by programmers in writing application programs. Many different highlevel programming languages exist, including BASIC, C, JAVA, FORTRAN,PASCAL, COBOL, ADA, APL, etc. Programs written in these high levellanguages are translated to the machine language level by translatorsknown as compilers or interpreters. The high level programming languagesin this level, as well as the assembly language level, are referred toherein as text-based programming environments.

Increasingly, computers are required to be used and programmed by thosewho are not highly trained in computer programming techniques. Whentraditional text-based programming environments are used, the user'sprogramming skills and ability to interact with the computer systemoften become a limiting factor in the achievement of optimal utilizationof the computer system.

There are numerous subtle complexities which a user must master beforehe can efficiently program a computer system in a text-basedenvironment. The task of programming a computer system to model orimplement a process often is further complicated by the fact that asequence of mathematical formulas, mathematical steps or otherprocedures customarily used to conceptually model a process often doesnot closely correspond to the traditional text-based programmingtechniques used to program a computer system to model such a process. Inother words, the requirement that a user program in a text-basedprogramming environment places a level of abstraction between the user'sconceptualization of the solution and the implementation of a methodthat accomplishes this solution in a computer program. Thus, a useroften must substantially master different skills in order to bothconceptualize a problem or process and then to program a computer toimplement a solution to the problem or process. Since a user often isnot fully proficient in techniques for programming a computer system ina text-based environment to implement his solution, the efficiency withwhich the computer system can be utilized often is reduced.

Examples of fields in which computer systems are employed to interactwith physical systems are the fields of instrumentation, processcontrol, industrial automation, and simulation. Computer measurement andcontrol of devices such as instruments or industrial automation hardwarehas become increasingly desirable in view of the increasing complexityand variety of instruments and devices available for use. However, dueto the wide variety of possible testing and control situations andenvironments, and also the wide array of instruments or devicesavailable, it is often necessary for a user to develop a custom programto control a desired system.

As discussed above, computer programs used to control such systemstraditionally had to be written in text-based programming languages suchas, for example, assembly language, C, FORTRAN, BASIC, etc. Traditionalusers of these systems, however, often were not highly trained inprogramming techniques and, in addition, text-based programminglanguages were not sufficiently intuitive to allow users to use theselanguages without training. Therefore, implementation of such systemsfrequently required the involvement of a programmer to write softwarefor control and analysis of instrumentation or industrial automationdata. Thus, development and maintenance of the software elements inthese systems often proved to be difficult.

U.S. Pat. Nos. 4,901,221; 4,914,568; 5,291,587; 5,301,301; and5,301,336; among others, to Kodosky et al disclose a graphical systemand method for modeling a process, i.e., a graphical programmingenvironment which enables a user to easily and intuitively model aprocess. The graphical programming environment disclosed in Kodosky etal can be considered a higher and more intuitive way in which tointeract with a computer. A graphically based programming environmentcan be represented at a level above text-based high level programminglanguages such as C, Basic, JAVA, etc.

The method disclosed in Kodosky et al allows a user to construct adiagram using a block diagram editor. The block diagram may include aplurality of interconnected icons such that the diagram createdgraphically displays a procedure or method for accomplishing a certainresult, such as manipulating one or more input variables and/orproducing one or more output variables. The diagram may have one or moreof data flow, control flow and/or execution flow representations. Inresponse to the user constructing a diagram or graphical program usingthe block diagram editor, data structures may be automaticallyconstructed which characterize an execution procedure which correspondsto the displayed procedure. The graphical program may be compiled orinterpreted by a computer.

Therefore, Kodosky et al teaches a graphical programming environmentwherein a user places or manipulates icons and interconnects or “wiresup” the icons in a block diagram using a block diagram editor to createa graphical “program.” A graphical program for measuring, controlling,or modeling devices, such as instruments, processes or industrialautomation hardware, or for modeling or simulating devices, may bereferred to as a virtual instrument (VI). Thus, a user can create acomputer program solely by using a graphically based programmingenvironment. This graphically based programming environment may be usedfor creating virtual instrumentation systems, modeling processes,control, simulation and numerical analysis, as well as for any type ofgeneral programming.

In creating a graphical program, a user may create a front panel or userinterface panel. The front panel may include various user interfaceelements or front panel objects, such as controls and/or indicators,that represent or display the respective input and output that will beused by the graphical program or VI, and may include other icons whichrepresent devices being controlled. The front panel may be comprised ina single window of user interface elements, or may comprise a pluralityof individual windows each having a user interface element, wherein theindividual windows may optionally be tiled together. When the controlsand indicators are created in the front panel, corresponding icons orterminals may be automatically created in the block diagram by the blockdiagram editor. Alternatively, the user can place terminal icons in theblock diagram which may cause the display of corresponding front panelobjects in the front panel, either at edit time or later at run time. Asanother example, the front panel objects, e.g., the GUI, may be embeddedin the block diagram.

During creation of the block diagram portion of the graphical program,the user may select various function nodes or icons that accomplish hisdesired result and connect the function nodes together. For example, thefunction nodes may be connected in one or more of a data flow, controlflow, and/or execution flow format. The function nodes may also beconnected in a “signal flow” format, which is a subset of data flow. Thefunction nodes may be connected between the terminals of the varioususer interface elements, e.g., between the respective controls andindicators. Thus the user may create or assemble a graphical program,referred to as a block diagram, graphically representing the desiredprocess. The assembled graphical program may be represented in thememory of the computer system as data structures. The assembledgraphical program, i.e., these data structures, may then be compiled orinterpreted to produce machine language that accomplishes the desiredmethod or process as shown in the block diagram.

Input data to a graphical program may be received from any of varioussources, such as from a device, unit under test, a process beingmeasured or controlled, another computer program, or from a file. Also,a user may input data to a graphical program or virtual instrument usingfront panel controls. This input data may propagate through the dataflow block diagram or graphical program and appear as changes on theoutput indicators. In an instrumentation application, the front panelcan be analogized to the front panel of an instrument. In an industrialautomation application the front panel can be analogized to the MMI (ManMachine Interface) of a device. The user may adjust the controls on thefront panel to affect the input and view the output on the respectiveindicators. Alternatively, the front panel may be used merely to viewthe input and output, or just the output, and the input may not beinteractively manipulable by the user during program execution.

Thus, graphical programming has become a powerful tool available toprogrammers. Graphical programming environments such as the NationalInstruments LabVIEW product have become very popular. Tools such asLabVIEW have greatly increased the productivity of programmers, andincreasing numbers of programmers are using graphical programmingenvironments to develop their software applications. In particular,graphical programming tools are being used for test and measurement,data acquisition, process control, man machine interface (MMI),supervisory control and data acquisition (SCADA) applications,simulation, machine vision applications, and motion control, amongothers.

As graphical programming environments have matured and grown inpopularity and complexity, it has become increasingly desirable toprovide high-level tools which help a user create a graphical program.In particular, it would be desirable to provide a system and method forautomatically generating a graphical program based on a state diagram(or automatically “translating” a state diagram to a graphical program).

A state diagram, also referred to as a state transition diagram, is awell-known type of diagram understood and used by many practitioners ofvarious scientific and engineering disciplines. A state diagramcomprises a finite number of “states”, which are typically drawn on thediagram as ovals or circles, as well as a finite number of“transitions”, which are drawn as arrows. Each transition arrow maybegin on the edge of one state oval and end on the edge of another (orthe same) state oval.

When used to describe the operation of a computer program, each statemay represent some instruction or sequence of instructions that isexecuted when the state is “active”. Note that these instructions arenot explicitly specified on the state diagram. Each state may simplyhave a text label that succinctly summarizes the functionality of thestate, such that a reader of the state diagram understands the operationof the program which the state diagram represents.

When the code for an active state has completed execution, the programthen needs to decide which state will become the new “active” state.This decision process is completely described by the transitions thatexit the (old) active state. Each transition arrow that begins on theedge of the active state's oval represents a condition that could beeither true or false. If the corresponding condition is true when theactive state is finished, the program chooses the state that thetransition arrow points to as the next active state. (If the programfollows a particular transition arrow to determine the next activestate, that transition is called the “active” transition.) Thetransition arrows in a state diagram may also be labeled with text tohelp a reader of the state diagram to understand the conditionsassociated with various transition arrows.

The state diagram may also specify an initial state that will be activewhen the program begins execution. This may be done in various ways, forexample, by drawing the initial state oval with a special style, e.g.,bold, or by adding an arrow which ends on the initial state oval, butbegins on a special “Start” marker oval which is distinct from the stateovals. In the latter instance, the arrow from the “Start” marker to theinitial state oval has no condition associated with it; i.e., the ovalto which this arrow points is unconditionally the initial active state.The state diagram may also indicate where the program will stop. Thismay be done in various ways, e.g., by introducing special “Stop” markerovals which are distinct from the state ovals and the “Start” marker. Toindicate that the program may stop when a particular state finishesexecution, there may be a transition arrow from that state to a “Stop”marker. Note that a transition to a “Stop” marker, like all transitionsexcept the one from the “Start” marker, does have a condition associatedwith it.

In theory, when a state has finished executing its code, one and onlyone of the conditions for the transition arrows exiting that state wouldbe true, i.e., one and only one transition would be “active” at the endof the state's execution. However, in practice it is difficult for thecreator of a state diagram to ensure that a general collection ofBoolean (True/False) conditions is mutually exclusive (i.e., that onlyone of them may be true). Hence, when creating a state diagram, thecreator may establish a priority ordering among the transitionconditions for a state, such that the first transition condition (inpriority order) that evaluates as true becomes the active transition andthus determines the next active state. In order to ensure that at leastone transition is active, each state may have a default transition,whose condition is always true, that comes last in the priorityordering.

FIG. 1 (prior art) illustrates an exemplary state diagram that specifiesthe operation of a computer program that tests whether numbers are primenumbers. As indicated by the “Start” marker, the program beginsexecution with “Choose Number” as the active state. This state might,for example, wait for the user to enter a number. At the end of thisstate, there are several transitions that could become active. If theuser indicates that he wishes to test the number to see if it is prime(e.g., by pressing a “Test Primality” button), then “divide by N”becomes the active state. If the user indicates that he wishes to stopthe program (e.g., by pressing a “stop” button), the program immediatelystops, as indicated by the “Stop” marker.

It is possible that neither of the above transition conditions are true(e.g. if the user has pressed neither button). In this case, the defaulttransition arrow returns again to the “Choose Number” state, so that theprogram waits for the user to press a button. It is also theoreticallypossible for both conditions to be true. Thus, as noted above, apriority ordering may be specified for the three transition arrows. Inthis case, the “Stop program?” transition arrow may have the highestpriority, indicating that if its corresponding condition is true, thenthis transition becomes the active transition regardless of whether ornot any other transition condition is true. As noted above, the“default” transition arrow has the lowest priority, since its conditionis always true. Note that in FIG. 1, the transition arrow priorities arenot indicated on the state diagram.

If the “Divide by N” state becomes active, the chosen number is dividedby an internal variable “N”, which may initially be set to 2. When thisdivision is completed, the program checks to see whether the user wishesto stop the calculation (e.g., by checking whether a “stop calculation”button is pressed). If so, the “cancel calculation” transition becomesactive, and the program re-enters the “Choose Number” state. If not, and“N” evenly divided the given number, the “divisible by N” transitionbecomes active, and the program enters the “Number is NOT prime” state,wherein a message indicating that the number is not prime may bedisplayed. If none of these conditions are true, the program enters the“increase N” state, wherein the variable N is incremented by 1. If N isgreater than the given number, then the number must be prime and thusenters the “Number is Prime” state, wherein a message indicating thatthe number is prime may be displayed. Otherwise, the program returns tothe “Divide by N” state to test divisibility of the chosen number by theincremented value of N.

Thus, the state diagram of FIG. 1 represents a significant amount ofprogram behavior in a simple, easily understood diagram. However, thisbehavior is represented at a very high level, and a state diagram is notan executable program. It would thus be desirable to enable a user to“translate” a state diagram into a graphical program. As describedabove, in prior systems, a user typically creates a graphical programwithin a graphical programming environment by interactively or manuallyplacing icons or nodes representing the desired blocks of functionalityon a diagram, and connecting the icons/nodes together. In contrast, itwould be desirable to provide a system and method for programmaticallygenerating a graphical program based on a state diagram, with little orno user input required.

A state diagram may not explicitly specify the program instructions orfunctionality to be performed when each state is active, and thus it maynot be possible to generate a complete graphical program implementingthe functionality represented by the state diagram. In this instance,users may greatly benefit from the automatic generation of a graphicalprogram “skeleton” that provides a framework for the various states andtransitions (and relationships among these) of the state diagram. Thedesired source code for each state and the desired source codespecifying the conditions for each transition can then be filled in(manually) to complete the graphical program.

SUMMARY OF THE INVENTION

One embodiment of the present invention comprises a system and methodfor programmatically generating a graphical program in response to statediagram information. The state diagram information preferably representsa state diagram (also called a “state flow diagram”), wherein the statediagram models or represents a desired algorithm or method. The statediagram may comprise a conventional state diagram or a sequentialfunction chart (SFC). The state diagram may represent desired operationof a software program or desired operation of a hardware device, orboth. In one embodiment, the state diagram may represent a higher levelrepresentation of a desired algorithm than even a graphical program, andthe present invention may be used to convert the state diagram into agraphical program or a graphical program framework. The state diagraminformation may specify a plurality of states and state transitions,wherein each state transition specifies a transition from a first stateto a second state. The state diagram information may also specify aninitial active “start” state and one or more “stop” states. For eachstate, the state diagram information may also specify a priorityordering among transitions exiting from the state.

A graphical program generation program, referred to herein as a “GPGprogram”, may be executed, wherein the GPG program may be operable toreceive the state diagram information. In response to the state diagraminformation, the GPG program may automatically, i.e., programmatically,generate a graphical program (or graphical program portion or graphicalprogram framework) based on the state diagram information. Thus, the GPGprogram may generate different graphical programs, depending on thestate diagram information received.

In programmatically generating a graphical program, the GPG program mayprogrammatically generate a block diagram portion. Programmaticallygenerating the block diagram portion of the graphical program maycomprise programmatically including graphical source code in the blockdiagram. This graphical source code may serve as a framework of thestates specified by the state diagram information and the statetransitions among the states.

During execution of the graphical program, for each state, programinstructions may be executed when that state is active. In oneembodiment these instructions (and the functionality performed by theseinstructions) may not be specified by the state diagram information.Thus, the GPG program may not automatically generate a completegraphical program that implements the functionality that the statediagram is intended to represent. In this instance, the graphical sourcecode framework automatically generated by the GPG program may beorganized to correspond to the state diagram information and may includevarious “placeholders” or “containers” enabling the user to easily fillin the graphical program with source code that specifies executioninstructions for each state and Boolean conditions for each statetransition.

In an alternative embodiment, the state diagram information may includeadditional information that can be used to generate a more completegraphical program. For example, when creating a state diagram using astate diagram editor, the user may associate program code with one ormore states in the state diagram, e.g., by dragging and dropping programcode icons from a palette onto the desired states, or by using a dialogbox to associate the program code with the states, etc. The program codeassociated with a state may specify code to be executed when the stateis active and/or may specify transition condition code. The program codemay comprise various types of executable or source modules, such as agraphical sub-program, DLL or other shared library, JAVA class, etc. TheGPG program may include the program code in the generated graphicalprogram or may enable the generated graphical program to interface withthe program code.

The programmatically generated graphical program or graphical sourcecode framework may be implemented in any of various ways. In variousembodiments, the generated graphical program may be associated with anyof various graphical programming development environments. Thus, thespecific graphical source code that is automatically generated maydepend on programming features supported by the particular graphicalprogramming development environment with which the program isassociated. Examples of generating graphical source code for the LabVIEWgraphical programming development environment are included.

The GPG program that generates the graphical program may be constructedusing any of various programming languages, methodologies, ortechniques. For example, the GPG program may itself be a graphicalprogram, or the GPG program may be a text-based program, or the GPGprogram may be constructed using a combination of graphical andtext-based programming environments.

Also, the GPG program may receive the state diagram information in anyof various ways. In one embodiment, the GPG program may include, may beassociated with, or may be, a program used to construct the statediagram, e.g., a state diagram editor program. For example, a user mayutilize a state diagram editor to construct a desired state diagram andmay then request a graphical program based on the state diagram to beautomatically created. For example, the user may select a menu option togenerate the graphical program. In response to the user's request, thestate diagram editor may execute program instructions toprogrammatically generate the graphical program or may invoke a separatemodule or program to perform the generation of the graphical program,passing the state diagram information (or a reference to theinformation) to this separate module or program. In another embodiment,a user may invoke the GPG program separately and request the GPG programto generate the graphical program, e.g., by specifying a previouslycreated state diagram file. The GPG program may be operable to receivethe state diagram information in any of various formats, e.g., as binarydata, XML data, text data, etc. The GPG program may process the statediagram information to determine the specified states of the statediagram, the state transitions, etc.

In one embodiment, the graphical program may be dynamically(programmatically) updated as the state diagram is being interactivelyconstructed by the user. For example, when the state diagram editor islaunched or creates a new state diagram, the new state diagram may beginas a simple diagram having a single initial state. A simple graphicalprogram corresponding to this initial state diagram may beprogrammatically generated. For example, a graphical programmingdevelopment application may be launched and the programmaticallygenerated graphical program may automatically appear in thisapplication. As the user performs various actions in the state diagrameditor, such as adding or deleting states, adding or deletingtransitions, changing the destination state of a transition, etc., thecorresponding graphical program may be dynamically (programmatically)updated to reflect the change.

In one embodiment, the generated graphical program may be “locked”,requiring the user to explicitly unlock the graphical program beforecertain modifications to the graphical program can be made within thegraphical programming environment. Locking the graphical program mayensure that the program's graphical source code is in a state known orexpected by the GPG program, thus facilitating the dynamic update of thegraphical program. For example, in one embodiment, the user may beallowed to add source code to the graphical program that specifiesexecution instructions for each state and Boolean conditions for eachstate transition, and may also be allowed to resize objects created bythe GPG program, but may be prevented from modifying the topology of theframework programmatically generated by the graphical program until thegraphical program is unlocked.

In various embodiments, the GPG program may be operable to generate anyof various types of graphical programs. As noted above, a generatedgraphical program may be targeted toward a particular graphicalprogramming development environment. The GPG program may thus utilizeproprietary features or create files that are formatted in a mannerexpected by the graphical programming development environment. This maybe desirable or necessary when the graphical programming developmentenvironment includes a runtime environment that is required for thecreated graphical program to execute. Examples of graphical programmingdevelopment environments include LabVIEW, BridgeVIEW, DasyLab, andDiaDem from National Instruments, VEE from Agilent, Simulink from TheMathWorks, Softwire from Measurement Computing, Inc., Sanscript fromNorthwoods Software, WiT from Coreco, and Vision Program Manager fromPPT Vision, among others.

A graphical program programmatically generated based on a state diagrammay be executed in any computing environment that supports the executionof graphical programs. For example, in one embodiment, the generatedgraphical program may be associated with a graphical programmingdevelopment environment that supports downloading graphical programs forexecution on reconfigurable or embedded hardware, such as hardware thatincludes configurable logic, such as a programmable logic device (PLD),e.g., an FPGA, or a processor and memory, which may execute a real timeoperating system. Among engineers who design algorithms to execute onembedded hardware, state diagrams are a popular means for representingalgorithms. Thus, an engineer may design an algorithm at a very highlevel as a state diagram, and this state diagram may be programmaticallytranslated into a graphical program whose high-level algorithmic designis based on the state diagram, for execution in various computingenvironments.

In various embodiments, the graphical program may be generated using anyof various methods or techniques. Generating the graphical program maycomprise generating one or more files or data structures defining thegraphical program. When a user interactively develops a graphicalprogram from within a graphical programming environment, the graphicalprogramming environment may create one or more program files. Forexample, the program files may specify information such as a set ofnodes included in the graphical program, interconnections among thesenodes, programmatic structures such as loops, etc. In other cases, theprogram files may store various data structures, e.g., in binary form,which the graphical programming environment uses to directly representthe graphical program. Thus, in programmatically generating thegraphical program, the GPG program may programmatically generate one ormore files or data structures representing the graphical program,wherein these files may be structured or formatted appropriately for aparticular graphical programming environment.

In one embodiment, a graphical programming development environment mayprovide an application programming interface (API) which is used inprogrammatically generating the graphical program. For example, for eachnode, programmatic structure, or other object of the graphical program,the API may be called to programmatically add the object to thegraphical program, connect the object to other objects of the graphicalprogram, etc. Thus, any necessary files or other constructs needed bythe graphical programming environment in order to use the generatedgraphical program may be automatically created as a result of callingthe API.

BRIEF DESCRIPTION OF THE DRAWINGS

A better understanding of the present invention can be obtained when thefollowing detailed description of the preferred embodiments isconsidered in conjunction with the following drawings, in which:

FIG. 1 (prior art) illustrates an exemplary state diagram;

FIG. 2 illustrates a computer system connected through a network to asecond computer system;

FIGS. 3A and 3B illustrate representative instrumentation and processcontrol systems including various I/O interface options;

FIG. 4 is a block diagram of the computer system of FIGS. 1, 2A and 2B;

FIG. 5 is a flowchart diagram illustrating one embodiment of a methodfor programmatically generating a graphical program based on statediagram information;

FIG. 6 is a flowchart diagram illustrating one embodiment of a methodfor dynamically (programmatically) updating a graphical program as auser interactively changes a state diagram on which the graphicalprogram is based;

FIG. 7 illustrates an exemplary initial state diagram that may bedisplayed by a state diagram editor program, e.g., when the userrequests to create a new state diagram;

FIG. 8 illustrates exemplary LabVIEW graphical program source code thatmay be programmatically generated based on the initial state diagramshown in FIG. 7;

FIGS. 9-18 illustrate various state diagram changes and illustratechanges to the corresponding LabVIEW graphical program that may beprogrammatically performed in response to these state diagram changes;

FIG. 19 illustrates an example in which a graphical program has beenprogrammatically generated based on the state diagram of FIG. 1 andillustrates an exemplary graphical user interface of a state diagrameditor; and

FIG. 20 is a block diagram illustrating the abstract relationshipbetween a client program, an API to programmatically generate/edit agraphical program, and a server program, to describe an embodiment inwhich a graphical program generation (GPG) program is implemented as aclient/server program.

While the invention is susceptible to various modifications andalternative forms specific embodiments are shown by way of example inthe drawings and are herein described in detail. It should be understoodhowever, that drawings and detailed description thereto are not intendedto limit the invention to the particular form disclosed, but on thecontrary the invention is to cover all modifications, equivalents andalternative following within the spirit and scope of the presentinvention as defined by the appended claims.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Incorporation byReference

The following references are hereby incorporated by reference in theirentirety as though fully and completely set forth herein.

U.S. Pat. No. 5,481,741 titled “Method and Apparatus for ProvidingAttribute Nodes in a Graphical Data Flow Environment,” issued on Jan. 2,1996.

U.S. Pat. No. 7,210,117, filed as application Ser. No. 09/745,023 titled“System and Method for Programmatically Generating a Graphical Programin Response to Program Information” filed on Dec. 20, 2000, whoseinventors were Ram Kudukoli, Robert Dye, Paul F. Austin, Lothar Wenzel,and Jeffrey L. Kodosky.

U.S. Pat. No. 7,200,838, filed as application Ser. No. 09/747,091,titled “System and Method for Programmatically Generating a GraphicalProgram in Response to a State Diagram”, filed Dec. 21, 2000, whoseinventors were Jeffrey L. Kodosky and Kevin Hogan.

U.S. Pat. No. 7,159,183, filed as application Ser. No. 09/518,492 titled“System and Method for Programmatically Creating a Graphical Program”filed on Mar. 3, 2000, whose inventors were Ram Kudukoli, Robert Dye,Melanie Jensen, and Yumiko Kawachi.

U.S. patent application Ser. No. 09/595,003 titled “System and Methodfor Automatically Generating a Graphical Program to Implement aPrototype” filed on Jun. 13, 2000, whose inventors were Nicolas Vazquez,Jeffrey L. Kodosky, Ram Kudukoli, Kevin L. Schultz, Dinesh Nair, andChristophe Caltagirone.

U.S. Pat. No. 6,173,438, filed as application Ser. No. 08/912,445 titled“Embedded Graphical Programming System” filed on Aug. 18, 1997, whoseinventors were Jeffrey L. Kodosky, Darshan Shah, Samson DeKey, and SteveRogers.

U.S. Pat. No. 6,219,628, filed as application Ser. No. 08/912,427 titled“System and Method for Converting Graphical Programs Into HardwareImplementations” filed on Aug. 18, 1997, whose inventors were Jeffrey L.Kodosky, Hugo Andrade, Brian Keith Odom, and Cary Paul Butler.

FIG. 2—Computer System Connected to a Network

FIG. 2 illustrates an exemplary computer network in which a computersystem 82 is connected through a network 84 to a second computer system86. The computer system 82 and the second computer system 86 can be anyof various types, as desired. The network 84 can also be any of varioustypes, including a LAN (local area network), WAN (wide area network), orthe Internet, among others.

The computer system 82 may include or store a computer program (orprograms), referred to herein as a graphical program generation program,or a “GPG program”, that is operable to receive state diagraminformation and programmatically generate a graphical program based onthe state diagram information. One embodiment of a method forprogrammatically generating a graphical program is described below.

In one embodiment, the GPG program may be implemented as aself-contained program or application that includes all necessaryprogram logic for generating the graphical program. In anotherembodiment, the GPG program may comprise a client portion and a serverportion (or client program and server program), wherein the clientportion may request or direct the server portion to generate thegraphical program. For example, the client portion may utilize anapplication programming interface (API) provided by the server portionin order to generate the graphical program. In other words, the clientportion may perform calls to the API provided by the server portion, andthe server portion may execute functions or routines bound to thesecalls to generate the graphical program. In one embodiment, the serverportion may be an instance of a graphical programming environmentapplication. For example, the LabVIEW graphical programming environmentapplication enables client programs to interface with a LabVIEW serverin order to programmatically generate or modify graphical programs.

As used herein, the term “GPG program” is intended to include any ofvarious implementations of a program (or programs) that are executableto programmatically generate a graphical program based on received statediagram information. For example, the term “GPG program” is intended toinclude an embodiment in which the GPG program is a self-containedprogram or application (not implemented as a client/server program) thatincludes all necessary program logic for programmatically generating agraphical program. The term “GPG program” is also intended to include anembodiment in which a combination of a client portion (or clientprogram) and server portion (or server program) operate together toprogrammatically generate the second graphical program. The term “GPGprogram” is also intended to include other program implementations.

In an embodiment of the GPG program in which a client program interfaceswith a server program to generate the graphical program, the serverprogram may execute on the same computer system as the client program ormay execute on a different computer system, e.g., a different computersystem connected via a network. For example, in FIG. 2, the clientprogram may execute on the computer system 82, and the server programmay execute on the computer system 86. In this case, the graphicalprogram, e.g., files representing the graphical program may be createdon the computer system 82, or 86, or on a different computer system.

It is noted that the GPG program may be implemented using any of variousprogramming technologies or methodologies. Where the GPG program isimplemented as client and server programs, each of these programs mayutilize procedure-based techniques, component-based techniques, and/orobject-oriented techniques, among others. The programs may be writtenusing any combination of text-based or graphical programming languages.Also, the programs may be written using distributed modules orcomponents so that each program may reside on any combination ofcomputer system 82, computer system 86, and other computer systemsconnected to the network 84. Also, in various embodiments, the clientprogram may interface with the server program through a proxy softwarecomponent or program.

The GPG program may include a program (or program instructions) forcreating the state diagram information upon which the programmaticallygenerated graphical program is based, or the GPG program may beassociated with or may interface with a separate program that createsthe state diagram information. For example, in one embodiment, the GPGprogram (or the client portion of the GPG program) may include a statediagram editor program that allows a user to interactively construct astate diagram. For example, such a state diagram editor may allow theuser to add and remove states, add and remove transition arrows betweenstates, define an initially active start state, define stop states,assign a priority ordering to transitions exiting from a given state,etc. The state diagram editor may include a graphical user interfacethat displays the current state of the state diagram as the diagram isconstructed.

In one embodiment, the state diagram editor may include a menu item orother means enabling the user to request a graphical program to beautomatically generated based on the current state diagram. In anotherembodiment, the user may invoke the GPG program separately and requestthe GPG program to automatically create the graphical program, e.g., byspecifying a file including the state diagram information.

In another embodiment, the graphical program may be dynamically(programmatically) updated as the state diagram is being interactivelyconstructed by the user in the state diagram editor. For example, whenthe state diagram editor is launched or creates a new state diagram, thenew state diagram may begin as a simple diagram having a single initialstate. A simple graphical program corresponding to this initial statediagram may be programmatically generated. For example, the statediagram editor may interface with a graphical programming developmentapplication, causing the graphical programming development applicationto (possibly launch and) programmatically generate the initial graphicalprogram, e.g., by calling an API provided by the graphical programmingdevelopment application. Thus, the initial graphical program may appearin a window of the graphical programming development application.

As the user performs various actions in the state diagram editor, suchas adding or deleting states, adding or deleting transitions, changingthe destination state of a transition, etc., the corresponding graphicalprogram may be dynamically (programmatically) updated within thegraphical programming development application window to reflect thechange. In one embodiment, the generated graphical program may be“locked”, requiring the user to explicitly unlock the graphical programbefore certain modifications can be made to the graphical program withinthe graphical programming development application. Locking the graphicalprogram may ensure that the program's graphical source code is in astate known or expected by the state diagram editor.

FIGS. 3A and 3B—Instrumentation and Industrial Automation Systems

FIGS. 3A and 3B illustrate exemplary systems which may store or use astate diagram editor program and/or a GPG program (which may be a GPGclient program and/or a GPG server program) such as described above.Also, the systems of FIGS. 3A and 3B may execute a graphical programprogrammatically generated based on state diagram information. Forexample, the graphical program may perform an instrumentation function,such as a test and measurement function or an industrial automationfunction. It is noted that a state diagram editor program, GPG program,and/or a generated graphical program may be stored in or used by any ofvarious other types of systems as desired and may implement any functionor application as desired. Thus, FIGS. 3A and 3B are exemplary only.

FIG. 3A illustrates an exemplary instrumentation control system 100. Thesystem 100 comprises a host computer 102 which connects to one or moreinstruments. The host computer 102 may comprise a CPU, a display screen,memory, and one or more input devices such as a mouse or keyboard asshown. The computer 102 connects through the one or more instruments toanalyze, measure, or control a unit under test (UUT) or process 150. Inone embodiment, the computer 102 may be either of the computers 82 or 86shown in FIG. 2, which as described above are operable toprogrammatically generate graphical programs based on state diagraminformation. Also, in one embodiment, the computer 102 may execute agenerated graphical program, such as a graphical program that controlsor models one or more of the connected instruments.

The one or more instruments may include one or more of a GPIB instrument112 and associated GPIB interface card 122, a data acquisition board 114and associated signal conditioning circuitry 124, a VXI instrument 116,a PXI instrument 118, a video device 132 and associated imageacquisition card 134, a motion control device 136 and associated motioncontrol interface card 138, and/or one or more computer based instrumentcards 142, among other types of devices.

The GPIB instrument 112 may be coupled to the computer 102 via the GPIBinterface card 122 comprised in the computer 102. In a similar manner,the video device 132 may be coupled to the computer 102 via the imageacquisition card 134, and the motion control device 136 may be coupledto the computer 102 through the motion control interface card 138. Thedata acquisition board 114 may be coupled to the computer 102, and mayinterface through signal conditioning circuitry 124 to the UUT. Thesignal conditioning circuitry 124 preferably comprises an SCXI (SignalConditioning eXtensions for Instrumentation) chassis comprising one ormore SCXI modules 126.

The GPIB card 122, the image acquisition card 134, the motion controlinterface card 138, and the DAQ card 114 are typically plugged in to anI/O slot in the computer 102, such as a PCI bus slot, a PC Card slot, oran ISA, EISA or MicroChannel bus slot provided by the computer 102.However, these cards 122, 134, 138 and 114 are shown external tocomputer 102 for illustrative purposes.

The VXI chassis or instrument 116 may be coupled to the computer 102 viaa VXI bus, MXI (e.g., MXI-3) bus, or other serial or parallel busprovided by the computer 102. The computer 102 preferably includes VXIinterface logic, such as a VXI, MXI or GPIB interface card (not shown),which interfaces to the VXI chassis 116. The PXI chassis or instrumentis preferably coupled to the computer 102 through the computer's PCIbus.

A serial instrument (not shown) may also be coupled to the computer 102through a serial port, such as an RS-232 port, USB (Universal Serialbus) or IEEE 1394 or 1394.2 bus, provided by the computer 102.

In typical instrumentation control systems an instrument will not bepresent of each interface type, and in fact many systems may only haveone or more instruments of a single interface type, such as only GPIBinstruments. The one or more instruments are coupled to the unit undertest (UUT) or process 150, or are coupled to receive field signals,typically generated by transducers. The system 100 may be used in a dataacquisition and control application, in a test and measurementapplication, a process control application, or a man-machine interfaceapplication.

FIG. 3B illustrates an exemplary industrial automation system 160. Theindustrial automation system 160 is similar to the instrumentation ortest and measurement system 100 shown in FIG. 3A. Elements which aresimilar or identical to elements in FIG. 3A have the same referencenumerals for convenience. The system 160 may comprise a computer 102which connects to one or more devices or instruments. The computer 102may comprise a CPU, a display screen, memory, and one or more inputdevices such as a mouse or keyboard as shown. The computer 102 mayconnect through the one or more devices to a process or device 150 toperform an automation function, such as MMI (Man Machine Interface),SCADA (Supervisory Control and Data Acquisition), portable ordistributed data acquisition, process control, advanced analysis, orother control. In one embodiment, the computer 102 may be either of thecomputers 82 or 86 shown in FIG. 2, which as described above areoperable to programmatically generate graphical programs based on statediagram information. Also, in one embodiment, the computer 102 mayexecute a programmatically generated graphical program, such as agraphical program that is involved with the automation functionperformed by the automation system 160.

The one or more devices may include a data acquisition board 114 andassociated signal conditioning circuitry 124, a PXI instrument 118, avideo device 132 and associated image acquisition card 134, a motioncontrol device 136 and associated motion control interface card 138, afieldbus device 170 and associated fieldbus interface card 172, a PLC(Programmable Logic Controller) 176, a serial instrument 182 andassociated serial interface card 184, or a distributed data acquisitionsystem, such as the Fieldpoint system available from NationalInstruments, among other types of devices.

The DAQ card 114, the PXI chassis 118, the video device 132, and theimage acquisition card 136 are preferably connected to the computer 102as described above. The serial instrument 182 is coupled to the computer102 through a serial interface card 184, or through a serial port, suchas an RS-232 port, USB, or IEEE 1394 or 1394.2 provided by the computer102. The PLC 176 couples to the computer 102 through a serial port,Ethernet port, or a proprietary interface. The fieldbus interface card172 is preferably comprised in the computer 102 and interfaces through afieldbus network to one or more fieldbus devices. Each of the DAQ card114, the serial card 184, the fieldbus card 172, the image acquisitioncard 134, and the motion control card 138 are typically plugged in to anI/O slot in the computer 102 as described above. However, these cards114, 184, 172, 134, and 138 are shown external to computer 102 forillustrative purposes. In typical industrial automation systems a devicewill not be present of each interface type, and in fact many systems mayonly have one or more devices of a single interface type, such as onlyPLCs. The devices are coupled to the device or process 150.

Referring again to FIGS. 3A and 3B, the computer system(s) 102preferably includes a memory medium(s) on which one or more computerprograms or software components according to one embodiment of thepresent invention are stored. For example, the memory medium may store aGPG program which is executable to receive state diagram information andprogrammatically generate a graphical program based on the state diagraminformation. The memory medium may also store a state diagram editorprogram operable to create the state diagram information (or, asdescribed above, the GPG program may include this functionality). Thesame or a different memory medium may also store a server program withwhich a client portion of the GPG program interfaces in order togenerate the graphical program. The memory medium may also store aprogrammatically generated graphical program. The memory medium may alsostore a graphical programming development application operable executeor edit the programmatically generated graphical program. It is notedthat various of these software programs may be stored on differentcomputer systems, as described above with reference to FIG. 2. Also, invarious embodiments, various of the above software programs may beimplemented or combined in different ways. For example, a graphicalprogramming development application may implement the server programwith which a client program interfaces to programmatically generate agraphical program.

The term “memory medium” is intended to include an installation medium,e.g., a CD-ROM, floppy disks 104, or tape device, a computer systemmemory or random access memory such as DRAM, SRAM, EDO RAM, Rambus RAM,etc., or a non-volatile memory such as a magnetic media, e.g., a harddrive, or optical storage. The memory medium may comprise other types ofmemory as well, or combinations thereof.

In addition, the memory medium may be located in a first computer inwhich the programs are executed, or may be located in a second differentcomputer which connects to the first computer over a network, such asthe Internet. In the latter instance, the second computer may providethe program instructions to the first computer for execution. Also, thecomputer system 102 may take various forms, including a personalcomputer system, mainframe computer system, workstation, networkappliance, Internet appliance, personal digital assistant (PDA),television system or other device. In general, the term “computersystem” can be broadly defined to encompass any device having at leastone processor which executes instructions from a memory medium.

In one embodiment, the state diagram editor, the GPG program, and/or theresulting graphical program that is programmatically generated may bedesigned or intended for data acquisition/generation, analysis, and/ordisplay, and/or for controlling or modeling instrumentation orindustrial automation hardware. For example, in one embodiment, theNational Instruments LabVIEW graphical programming developmentapplication, which provides specialized support for developers ofinstrumentation applications, may act as the GPG server program. In thisembodiment, the GPG client program may be a software program thatreceives and processes state diagram information and invokesfunctionality of the LabVIEW graphical programming environment toprogrammatically generate a LabVIEW graphical program.

However, it is noted that the present invention can be used for aplethora of applications and is not limited to instrumentation orindustrial automation applications. In other words, FIGS. 3A and 3B areexemplary only, and graphical programs for any of various types ofpurposes may be programmatically generated based on any of various typesof state diagram information, and the generated graphical programs maybe stored in and may execute on any of various types of systems.

FIG. 4—Computer System Block Diagram

FIG. 4 is a block diagram of the computer system illustrated in FIGS. 2,3A and 3B. It is noted that any type of computer system configuration orarchitecture can be used as desired, and FIG. 4 illustrates arepresentative PC embodiment. It is also noted that the computer systemmay be a general purpose computer system as shown in FIGS. 3A and 3B, acomputer implemented on a VXI card installed in a VXI chassis, acomputer implemented on a PXI card installed in a PXI chassis, or othertypes of embodiments. The elements of a computer not necessary tounderstand the present invention have been omitted for simplicity.

The computer 102 includes at least one central processing unit or CPU160 which is coupled to a processor or host bus 162. The CPU 160 may beany of various types, including an x86 processor, e.g., a Pentium class,a PowerPC processor, a CPU from the SPARC family of RISC processors, aswell as others. Main memory 166 is coupled to the host bus 162 by meansof memory controller 164.

The main memory 166 may store computer programs according to oneembodiment of the present invention, e.g., as described above. The mainmemory 166 also stores operating system software as well as the softwarefor operation of the computer system, as well known to those skilled inthe art.

The host bus 162 is coupled to an expansion or input/output bus 170 bymeans of a bus controller 168 or bus bridge logic. The expansion bus 170is preferably the PCI (Peripheral Component Interconnect) expansion bus,although other bus types can be used. The expansion bus 170 includesslots for various devices such as the data acquisition board 114 (ofFIG. 3A) and a GPIB interface card 122 which provides a GPIB businterface to the GPIB instrument 112 (of FIG. 3A). The computer 102further comprises a video display subsystem 180 and hard drive 182coupled to the expansion bus 170.

As shown, a reconfigurable instrument 190 may also be connected to thecomputer 102. The reconfigurable instrument 190 may include configurablelogic, such as a programmable logic device (PLD), e.g., an FPGA, or aprocessor and memory, which may execute a real time operating system.According to one embodiment of the invention, a graphical programprogrammatically generated based on state diagram information may bedownloaded and executed on the reconfigurable instrument 190. Forexample, a graphical programming environment with which the graphicalprogram is associated may provide support for downloading a graphicalprogram for execution on configurable logic in a real time system. Invarious embodiments, the configurable logic may be comprised on aninstrument or device connected to the computer through means other thanan expansion slot, e.g., the instrument or device may be connected viaan IEEE 1394 bus, USB, or other type of port. Also, the configurablelogic may be comprised on a device such as the data acquisition board114 or another device shown in FIG. 3A.

Among engineers who design algorithms to execute on embedded hardware,state diagrams are a popular means for representing algorithms. Thus, anengineer may design an algorithm at a very high level as a statediagram, and this state diagram may be programmatically translated intoa graphical program or graphical program framework whose high-levelalgorithmic design is based on the state diagram. The resultinggraphical program may then be executed in any computing environment thatsupports the execution of graphical programs, including embedded orreconfigurable hardware.

FIG. 5—Programmatic Generation of a Graphical Program Based on StateDiagram Information

In prior systems, a user interactively or manually creates or edits agraphical program. For example, the user may interactively add variousobjects or icons to a graphical program block diagram, connect theobjects together, etc. In contrast, one embodiment of the presentinvention comprises a system and method for programmatically generatinga graphical program (or portion of a graphical program) withoutrequiring this type of user interaction. FIG. 5 is a flowchart diagramillustrating one embodiment of a method for programmatically generatinga graphical program based on state diagram information.

In step 200, state diagram information may be created, e.g., in responseto user input. For example, as described above with reference to FIG. 2,the user may utilize a state diagram editor program that allows the userto create a state diagram. The state diagram editor may include agraphical user interface that displays the current state of the statediagram as the diagram is interactively constructed. In otherembodiments, the state diagram information may be created in any ofvarious other ways. A program having a graphical user interface thatdisplays a state diagram corresponding to the state diagram informationis not necessarily used. For example, the state diagram information maysimply be created as a text file structured in such a way as to specifythe states, state transitions, etc.

As used herein, the term “state diagram information” comprisesinformation that specifies at least: one or more states; and one or morestate transitions, wherein each state transition specifies a transitionfrom a first state to a second state (wherein the first and secondstates may be the same). In various embodiments, the state diagraminformation may also specify information such as: an initially activestart state; one or more stop states; a priority ordering fortransitions exiting from a given state; etc.

The state diagram information preferably represents a state diagram(also called a “state flow diagram”), wherein the state diagram modelsor represents a desired algorithm or method. The state diagraminformation may also represent a sequential function chart (SFC). Asequential function chart is similar to a state diagram, with oneexception being that multiple states can execute concurrently. The statediagram may represent desired operation of a software program or desiredoperation of a hardware device, or both. In one embodiment, the statediagram may represent a higher level representation of a desiredalgorithm than even a graphical program, and the present invention maybe used to convert the state diagram into a graphical program or agraphical program framework.

Another example of a state diagram is a test sequence, e.g., where thetest sequence is represented as a plurality of states representing therespective tests in the sequence as well as the transitions between thesteps. As used herein, a “test sequence” specifies a sequence ofexecutable test modules as well as transitions or flow between the testmodules, wherein the test sequence is used to test a unit under test.

In step 202, a graphical program generation (GPG) program may receivethe state diagram information created in step 200. It is noted that theGPG program is not necessarily separate from a program used to createthe state diagram information. For example, a single program orapplication may include functionality for both creating the statediagram information and programmatically generating the graphicalprogram (and/or invoking a server program to cause the graphical programto be programmatically generated). In other embodiments, the GPG programmay be a separate program.

Thus, in various embodiments the GPG program may receive the statediagram information in any of various ways and from any of various typesof sources. For example, the GPG program may be operable to read thestate diagram information from a memory location in which the statediagram information was stored, or the state diagram information may bepassed to the GPG program programmatically using standard programmingtechniques, or the GPG program may be operable to read the state diagraminformation from a file, etc. Also, in various embodiments, the receivedstate diagram information may be structured or formatted in any way andmay comprise various types of data, such as text data, binary data, XMLdata, etc.

In step 204, the GPG program may automatically, i.e., programmatically,generate a graphical program (or graphical program portion or graphicalprogram framework) based on the received state diagram information. Thegraphical program may be programmatically generated with little or nouser input received during this generating. In one embodiment, thegraphical program is programmatically generated with no user inputrequired. In another embodiment, the user may be prompted for certaindecisions during programmatic generation, such as the type of graphicalprogram to generate, the number or degree of comments contained withinthe graphical program, a file name for the graphical program, etc.

In programmatically generating the graphical program, the GPG programmay specify the inclusion of various objects in the new graphicalprogram, such as nodes and/or programmatic structures (e.g., loops, casestructures, etc.) to include in a block diagram of the graphicalprogram. The new graphical program may also include a user interfaceportion including various user interface objects, such as one or moreuser interface panels having controls for specifying user input to thegraphical program and/or indicators for displaying output from thegraphical program. As described above, block diagram objects in agraphical program are typically interconnected so as to visuallyindicate functionality of the program. Thus, the GPG program may alsoconnect or wire the block diagram objects together appropriately. Also,the GPG program may specify positions and/or sizes of the objects (e.g.,to create an easily readable block diagram), among other properties orconfiguration of the objects (e.g., configuration of data types,parameters, etc.).

In various embodiments, the GPG program may be operable to generate anyof various types of graphical programs. The generated graphical programmay be targeted toward a particular graphical programming developmentenvironment. Thus, in programmatically generating the program, the GPGprogram may utilize proprietary features or create files that areformatted in a manner expected by the graphical programming developmentenvironment. This may be desirable or necessary when the graphicalprogramming development environment includes a runtime environment thatis required for the generated graphical program to execute. Examples ofgraphical programming development environments include LabVIEW,BridgeVIEW, DasyLab, and DiaDem from National Instruments, VEE fromAgilent, Simulink from The MathWorks, Softwire from MeasurementComputing, Inc., Sanscript from Northwoods Software, WiT from Coreco,and Vision Program Manager from PPT Vision, among others.

Programmatically generating the graphical program may comprisegenerating one or more files or data structures defining the graphicalprogram. When a user interactively develops a graphical program fromwithin a graphical programming environment, the graphical programmingenvironment may create one or more program files. For example, theprogram files may specify information such as a set of nodes included inthe graphical program, interconnections among these nodes, programmaticstructures such as loops, etc. In other cases, the program files maystore various data structures, e.g., in binary form, which the graphicalprogramming environment uses to directly represent the graphicalprogram. Thus, in programmatically generating the graphical program, theGPG program may programmatically generate one or more files or datastructures representing the graphical program, wherein these files maybe structured or formatted appropriately for a particular graphicalprogramming environment.

As described above, when a state diagram is used to represent theexecution of a computer program, each state of the state diagram maycorrespond to a program instruction or sequence of instructions that maybe executed when that state is active. However, in one embodiment theseinstructions (and the functionality performed by these instructions) maynot be specified by the state diagram information, and the GPG programmay not automatically generate a program that implements the completefunctionality that the state diagram is intended to represent. In thisinstance, in programmatically generating the graphical program, the GPGprogram may generate graphical source code for the program that servesas a “framework” for the states specified by the state diagraminformation and the state transitions among the states. This graphicalsource code framework may be organized to correspond to the statediagram information and may include various “placeholders” or“containers” enabling the user to easily fill in the graphical programwith source code that specifies the desired execution instructions foreach state and the desired Boolean conditions for each state transition.As described below, in alternative embodiments, the state diagraminformation may include program information such that executioninstructions for some or all of the states and state transitions can beautomatically included in the graphical program.

In various embodiments, programmatically generated graphical code may beimplemented or structured in any of various ways. Since, as describedabove, the generated graphical program may be associated with any ofvarious graphical programming development environments, the specificgraphical source code that is automatically generated may depend onprogramming features supported by the particular graphical programmingdevelopment environment with which the program is associated. Oneembodiment of automatically generating a graphical source code frameworkfor the LabVIEW graphical programming development environment isdescribed below.

The GPG program that generates the graphical program may be constructedusing any of various programming languages, methodologies, ortechniques. For example, the GPG program may itself be a graphicalprogram, or the GPG program may be a text-based program, or the GPGprogram may be constructed using a combination of graphical andtext-based programming environments.

In one embodiment, the GPG program may be a self-contained program thatincludes all executable logic necessary for programmatically generatingthe new graphical program. However, in another embodiment, the GPGprogram utilizes a client/server programming model, in which the clientportion creates and/or processes the state diagram information anddetermines the graphical program to be generated based on the statediagram information (i.e., determines the block diagram objects to beincluded in the program, the interconnections among these objects,etc.). The client portion may then call an API provided by the serverportion to request the server portion to perform the actual creation ofthe new graphical program, e.g., by creating files and/or other datastructures representing the new graphical program. The server portionmay execute on the same computer system as the client portion or mayexecute on a different computer system, e.g., a different computersystem connected by a network. In one embodiment, the server portion maybe an instance of a graphical programming development environmentapplication, which provides an API enabling client programs toprogrammatically create and/or edit graphical programs.

The method of FIG. 5 is illustrated and is described above in terms ofgenerating a new graphical program. It is noted that a similar methodmay be used to modify an existing graphical program, e.g., in order toadd functionality to the program. In other words, instead of specifyingcreation of a new graphical program, the GPG program may specify themodification of an existing graphical program. When executed, the GPGprogram is then operable to programmatically modify the existinggraphical program. For example, the GPG program may include a referenceto the existing graphical program and may perform various API calls tomodify the graphical program, e.g., by adding one or more objects to thegraphical program, changing connections between graphical programobjects, changing various properties of graphical program objects, etc.

It is noted that FIG. 5 represents one embodiment of a method forprogrammatically generating a graphical program, and various steps maybe added, reordered, combined, omitted, modified, etc.

FIG. 6—Stepwise Programmatic Generation of a Graphical Program Based onState Diagram Information

In one embodiment, a graphical program may be programmatically generatedfrom a completed state diagram. In another embodiment, a graphicalprogram may be programmatically generated as the state diagram isconstructed. In other words, for each interactive change that a usermakes to the state diagram, the graphical program may be updated toreflect this change. FIG. 6 is a flowchart diagram illustrating oneembodiment of a method for dynamically (programmatically) updating agraphical program as a user interactively changes a state diagram onwhich the graphical program is based.

In step 220, a state diagram editor program may be executed. Asdescribed above, such a program may allow the user to construct a statediagram by performing actions such as: adding and removing states,adding and removing transition arrows between states, defining aninitially active start state, defining stop states, assigning a priorityordering to transitions exiting from a given state, etc. The statediagram editor may include a graphical user interface that displays thecurrent state of the state diagram as the diagram is constructed.

In step 224, the state diagram editor program may display an initialstate diagram. For example, when the state diagram editor program firstlaunches or when the user requests to create a new state diagram, theeditor program may display an initial state diagram, which the user maythen change, e.g., by adding states and state transitions to thediagram. FIG. 7 illustrates an exemplary initial state diagram. In thisexample, the diagram includes a single state labeled “Init” with adefault transition to itself and a “Start” marker to specify that thisstate is the initially active state.

In step 226, the state diagram editor may programmatically generate aninitial graphical program corresponding to the initial state diagram. Inone embodiment, the state diagram editor may interface with a GPG serverprogram in order to request or direct the GPG server program to generatethe initial graphical program. The GPG server program may provide anapplication programming interface (API) for programmatically generatinggraphical programs. In one embodiment, the GPG server program may be agraphical programming development environment application. For example,the LabVIEW graphical programming development environment applicationprovides an API which client programs may use to programmaticallygenerate or modify graphical programs.

In addition to programmatically generating the initial graphicalprogram, the GPG server program may also be operable to display theinitial graphical program, e.g., in a separate window, as shown in step228. Thus, a user constructing a new state diagram via the state diagrameditor program may be able to view the initial graphical programcorresponding to the initial state diagram.

In step 230, the state diagram editor program may receive user inputspecifying a change to the state diagram. Various types of possiblechanges are listed above (e.g., adding a state, adding a transition,etc.)

In step 232, in response to the state diagram change performed in step230, the state diagram editor may programmatically update the graphicalprogram to correspond to the specified change, e.g., by calling an APIof the GPG server program to perform the update. Thus, the API mayenable not only the creation of a new graphical program, but may alsoallow modifications to an existing graphical program.

In step 234, the GPG server program may display the updated graphicalprogram (or may re-display the updated graphical program in an existingwindow). Thus, as the user interactively changes the state diagram, thecorresponding graphical program may be automatically changed also, suchthat the user can immediately see the results of the change. Asindicated by the flowchart loop from step 234 to step 230, the processof the user changing the state diagram and automatically updating thegraphical program in response may be an iterative process.

FIGS. 8-18: Examples of Programmatically Generated Graphical Source Code

As described above, in various embodiments, the programmaticallygenerated graphical program may be associated with any of variousgraphical programming development environments, and the graphical sourcecode included in the graphical program may vary depending on theparticular development environment. FIGS. 9-18 illustrate exemplarygraphical source code which may be programmatically generated for theLabVIEW graphical programming development environment. For moreinformation on the operation of the illustrated LabVIEW graphical sourcecode, please refer to the LabVIEW user documentation, available fromNational Instruments Corp., which is hereby incorporated by reference.

The text accompanying these figures describes various changes that auser may make to a state diagram and the results of these changes on thegraphical source code. Thus, in one embodiment the LabVIEW graphicalprogram may be progressively updated as a user edits the state diagram,as described above with reference to FIG. 6. In another embodiment, theentire LabVIEW graphical program may be generated a single time from acompleted state diagram, if desired.

FIG. 8—Initially Generated Graphical Program

FIG. 8 illustrates exemplary LabVIEW graphical program source code whichmay be programmatically generated based on the initial state diagramshown in FIG. 7 (i.e., this code may be generated and displayed in steps226 and 228 of FIG. 6).

The graphical source code for this default diagram comprises a large“While” loop programmatic structure 400 with a shift register 402. (Ashift register is a local variable that feeds back or transfers valuesfrom the completion of one iteration of the loop to the next. The shiftregister includes a pair of terminals 402 opposite each other on thevertical sides of the loop border. The right terminal stores the data atthe completion of an iteration. LabVIEW shifts that data at thecompletion of an iteration, and the data appears in the left terminal,in time for the next iteration. The shift register may be initialized bywiring a constant value 410 from outside the loop to the left terminal.)

A “Case” programmatic structure 404 is also included inside the whileloop 400. In principle, a LabVIEW case structure is similar to a casestatement in the C programming language. The Case structure can havemultiple subdiagrams, configured like a deck of cards, of which only oneis visible at a time. At the top of the structure border is displayed adiagram identifier 406 that displays the value causing the currentlydisplayed subdiagram to execute. By clicking the decrement and incrementbuttons to the left and right, respectively, of the diagram identifier,the user can cycle through the subdiagrams of the case structure. Duringexecution, the value wired to the case selector 408 determines whichsubdiagram (i.e., which “case”) executes.

In the program of FIG. 8, the shift register 402 stores an enumerateddata type which specifies the current “active” state of the program,wherein there is exactly one enumerated type entry for each state in thestate diagram. (As described below, there may also be one extra entry ifany “Stop” marker is added to the state diagram). The shift registervalue is wired to the case selector 408, which selects the appropriatesubdiagram code to execute for the current active state. Notice that theshift register is initialized with a constant value 410 from theenumerated type to reflect the initial active state specified in thestate diagram; i.e., it is initialized to the “Init” state pointed to bythe “Start” marker in FIG. 7.

The case structure 404 includes one case or subdiagram for every statein the state diagram. Thus, for the default diagram of FIG. 7, there isonly one case listed in this structure—the case for the “Init” state(indicated by the diagram identifier 406). As described below, when theuser adds a state to the state diagram, a corresponding case orsubdiagram is added to the case structure 404.

The subdiagram for the “Init” state (and for future states added as theuser adds states to the state diagram) is left mostly empty, to allowthe user to specify exactly what set of instructions should be executedwhen this state becomes active. As noted above, in one embodiment theseinstructions may not be specified explicitly in the state diagram, andthe instructions may not be automatically included in the generatedgraphical program. Thus, the programmatically generated subdiagram foreach case may serve as a “placeholder” or “container” where the user canadd source code to perform the desired functionality for when that caseis active, as indicated in FIG. 8. In other embodiments, e.g., whengenerating graphical source code for other graphical programmingdevelopment environments, this type of “placeholder” or “container” codemay be implemented in any of various other ways. Also, as noted above,in alternative embodiments source code defining the functionality forwhen a case is active may be generated automatically.

Since information about possible transitions between states is specifiedin the state diagram, it is possible to automatically generate most ofthe code needed to determine the next active state. After the user-addedcode for the active state executes, this programmatically generated codeexecutes to determine the next active state. The programmaticallygenerated code for evaluating transition conditions is included within awhile loop 420. The while loop 420 uses an enumerated data type 422which is unique to the state which corresponds to the particular casesubdiagram currently displayed. This enumerated type 422 includesexactly one entry for each transition that leaves the state thatcorresponds to the currently displayed case. (Thus, in the initialgraphical program, there is only an entry for the default transitionshown in FIG. 7).

In one embodiment, the entries of the enumerated type 422 may be orderedby transition priority, if such a priority is specified in the statediagram. Higher priority transitions may have lower values in theenumeration. Thus, when the while loop 420 executes, the values of theenumerated type 422 are fed, one by one, in order from highest priorityvalue to lowest, into a case structure 424. This is done by convertingthe (integer) values from the loop index terminal 426 into thetransition enumerated data type. The case structure 424 includes onecase subdiagram for each transition, and has two output values: thevalue 428 of the new active state (assuming the condition for thistransition evaluates to be true), and the Boolean value 430 of thecondition for this transition.

The value 430 of the transition condition is passed to the conditionalterminal 432 of the while loop 420, which causes the while loop 420 toterminate if the condition value 430 is true. When the while loop 420terminates, the value 428 for the new active state is passed out of thewhile loop 420 and into the right terminal of the shift register 402,thus specifying the value of the new active state for the next iterationof the outer while loop 400. Thus, the inner while loop 420 evaluatestransition conditions from highest priority to lowest, and as soon as a“true” condition is encountered, it selects the new active statespecified by that transition.

Note that in the case of the default state diagram of FIG. 7, the onlytransition out of the “Init” state is the default transition. Asdescribed above, by definition, the condition for a default transitionis always true. Thus, in FIG. 8, a Boolean constant of “True” isgenerated as the condition value. As shown in FIG. 7, the new activestate for the default transition is again the “Init” state. Thus, the“Init” enumerated value is generated as the value of the new activestate. For transitions other than a default transition, the statediagram may not specify what Boolean conditions are associated with thetransition. Thus, for other transitions, the user may need to addgraphical source code so that the transition evaluates to the desiredBoolean value during execution. As described below, in some embodiments,it may be possible to automatically generate such source code.

Once all of the code for the current case subdiagram of the large casestructure 404 has finished execution, the condition terminal 440 of theouter while loop 400 is evaluated to determine whether or not theprogram should continue execution. Since the default state diagram ofFIG. 7 has no “Stop” marker to denote when the program should stop, thisterminal 440 is left unwired in the FIG. 8 LabVIEW diagram. This leavesthe user free to add any kind of termination condition desired, e.g., bywiring in a “Stop” button which can halt the execution of the program atthe end of any state. If the program does not stop, the while loop 400performs another iteration, executing code for the new active state andthen evaluating the transitions for that state.

From the initial state diagram of FIG. 7, the user may edit the diagram.For example, in various embodiments the user may edit the diagram byadding a state, adding a transition, changing the destination state ofan existing transition, re-ordering the priority of transitions thatoriginate from a particular state, renaming a state or transition,deleting a state or transition, adding or deleting a “Stop” marker, etc.FIGS. 9-18 illustrate various state diagram changes and changes to thegraphical program which may be programmatically performed in response tothese state diagram changes.

FIGS. 9-10: Adding a State

FIG. 9 illustrates a state diagram in which a new state has been addedto the state diagram of FIG. 7. As shown, the new state may initiallyhave a default transition returning to itself. To update the graphicalprogram, it is necessary to programmatically add a new entry in theenumerated type for states. In addition, it is necessary toprogrammatically add a new case subdiagram corresponding to the newstate to the outer case structure 404. FIG. 10 illustrates theprogrammatically updated LabVIEW code after these changes have beenmade, in which the “New State” state is selected as the currentsubdiagram for the case structure 404. This subdiagram appearssubstantially similar to the one shown in FIG. 8, except for the case(the name of the state) identified by the diagram identifier 406 and thenew active state specified by the default transition (i.e., “New State”instead of “Init”).

FIGS. 11-12: Adding a Transition

FIG. 11 illustrates a state diagram in which a transition has been addedto the state diagram of FIG. 9, wherein the transition arrow goes fromthe “Init” state to the “New State” state. To effect this change in thegraphical program, it is only necessary to programmatically change thecode in the case structure 404 subdiagram corresponding to the statefrom which the transition originates, (the “Init” state in this case) asshown in FIG. 11. With respect to this subdiagram, it is sufficient toprogrammatically add a new entry to the transition enumeration 422, andthen programmatically add a corresponding case subdiagram to the smallercase structure 424. Within this new case subdiagram, a constantspecifying the destination state of the new transition (“New State” inthis case) is wired for the output value 428 indicating the new activestate, as shown in FIG. 11. As described above, the condition for thenew transition is an arbitrary expression to be specified by the user;thus, no code for the new transition's condition is added to thegraphical program, and the condition terminal 432 of the while loop 420is left unwired.

If the state diagram editor supports the assignment of priority valuesto transitions, then the values of the transition enumeration 422 may bereassigned, if necessary, to reflect the desired priority order.

FIGS. 13-14: Changing the Destination State of an Existing Transition

FIG. 13 illustrates the state diagram of FIG. 11, in which the defaulttransition for the “New State” state has been changed to point to the“Init” state. To effect this change in the graphical program, it is onlynecessary to programmatically change one constant value. This constantvalue is located in the case structure diagram corresponding to thetransition that is changed. Thus, the constant value is located in thecase structure 404 subdiagram corresponding to the state in which thetransition originates, and within that subdiagram, it is further locatedwithin the subdiagram of the smaller case structure 424 that correspondsto the specific transition that was changed. FIG. 14 illustrates thischange. FIG. 14 is identical to FIG. 10, except that the constant value428 for the new active state has been programmatically changed to the“Init” enumerated type value instead of the “New State” enumerated typevalue. Thus, if the default transition from the “New State” state isfollowed, the new active state will now be the “Init” state, since the“Init” enumerated type value is now wired to the right terminal of theshift register 402.

Re-Ordering the Priority of Transitions from a Given State

Similarly as noted above, to re-order the priority of transitions from agiven state, it is sufficient to programmatically change values of thetransition enumeration 422 in the case structure 424 subdiagram for thegiven state.

Renaming a State or Transition

To rename a state, it is sufficient to programmatically change thecorresponding entry in each state enumeration constant on the LabVIEWdiagram. To rename a transition, it is sufficient to programmaticallychange the corresponding entry in the transition enumeration constantthat contains the transition.

FIGS. 15-17: Deleting a Transition

FIG. 15 illustrates the state diagram of FIG. 13, in which the “NewTransition” transition from the “Init” state to the “New State” statehas been deleted. To effect this change in the graphical program, it issufficient to programmatically delete the subdiagram corresponding tothe deleted transition from the smaller case structure 424 within thesubdiagram corresponding to the state from which the deleted transitionoriginates. In one embodiment, deleting default transitions may not beallowed. The constant value corresponding to the deleted transition mayalso be programmatically removed from the transition enumeration 422.FIGS. 16 and 17 illustrate the graphical program before and after the“New Transition” transition has been programmatically deleted,respectively.

Deleting a State

To delete a state, first all transitions may be deleted whosedestination is the state to be deleted and whose origin is not the stateto be deleted. This may be done as described above. Any defaulttransitions whose destination is the state to be deleted may be revertedto having their destination be the same as their state of origin. Thismay be performed in the same fashion as changing the destination stateof an existing transition, as described above. Finally, it remains toprogrammatically remove the case subdiagram from the large casestructure 404 that corresponds to the state to be deleted, and then toprogrammatically remove the state's name from the state enumerationconstants which remain. When the state to be deleted is removed from theconstant that initializes the left terminal of the shift register 402,this has the effect of changing the initial state to one of theremaining states. In one embodiment, a state may be deleted only if itis not the only state in the state diagram.

FIG. 18—Adding a “Stop” Marker

If there is no other “Stop” marker in the state diagram, the addition ofa “Stop” marker is very similar to what happens when a new state isadded. First, a “STOP” value is programmatically added to the stateenumeration constants. Secondly, a new subdiagram is programmaticallyadded to the large case structure 404 to accommodate the new “STOP”state. However, since there are no transitions out of this state, noinner while loop 420 or case structure 424 is needed. Finally, code isprogrammatically added to test whether or not the next active state isto be the “STOP” state, and if so, the outer while loop 400 is stopped,as shown in FIG. 18.

Adding a new “Stop” marker preferably has no effect if there is alreadyanother “Stop” marker in the state diagram.

Deleting a “Stop” Marker

Removal of any “Stop” marker from the state diagram results in theprogrammatically removal of any transitions whose destination is themarker to be deleted (see “Deleting a transition” above). However,unless the “Stop” marker is the only such marker on the transitiondiagram, no other code changes are made. If it is the last “Stop”marker, the diagram for the “STOP” state in the large case structure isprogrammatically removed, along with the code to stop the outer loop ifthe next active state is “STOP”. In addition, the “STOP” state isprogrammatically removed from the state enumeration constants.

Changing the Destination State of the “Start” Marker Transition

Changing the destination state of the “Start” marker's transition simplyresults in programmatically changing the value of the state enumerationconstant that initializes the left terminal of the shift register 402.

Locking the Graphical Program

As described above, in one embodiment, the programmatically generatedgraphical program may be “locked”, requiring the user to explicitlyunlock the graphical program before certain modifications to thegraphical program can be made within the graphical programmingenvironment. Locking the graphical program may ensure that the program'sgraphical source code is in a state known or expected by the GPGprogram, thus facilitating the dynamic update of the graphical program.For example, in one embodiment, the user may be allowed to add sourcecode to the graphical program that specifies execution instructions foreach state and Boolean conditions for each state transition, and mayalso be allowed to resize objects created by the GPG program.

However, the user may be prevented from modifying the topology of theframework programmatically generated by the graphical program until thegraphical program is unlocked. For example, with respect to the specificexamples given above, until the graphical program is unlocked the usermay be prevented from removing the programmatically generated casestructures, while loops, and wires that connect the state and transitionconstants to the case structures. The user may also be prevented fromremoving or renaming the state and transition constants.

FIG. 19—Example

FIG. 19 illustrates an example in which a graphical program has beenprogrammatically generated based on the state diagram of FIG. 1. Asdescribed above, the GPG program may comprise, may be associated with,or may interface with a state diagram editor. FIG. 19 illustrates anexemplary graphical user interface of a state diagram editor, in whichthe state diagram of FIG. 1 is shown. FIG. 19 also illustrates a blockdiagram portion corresponding to the “Number is NOT Prime” state of thestate diagram of FIG. 1. In this block diagram portion, the user hasmanually added graphical code to specify program instructions to executewhen this state is active. In this case, the added code is operable todisplay a user interface message indicating that the chosen number isnot prime.

As described above, in one embodiment the graphical program may bedynamically updated as the user develops the state diagram. Thus, thestate diagram editor may in a sense be seen as an interactive programdevelopment tool. The state diagram editor may additional includefunctionality which aids the user in developing the desired graphicalprogram, such as functionality providing further integration with thegraphical programming development environment with which the graphicalprogram is associated. For example, the state diagram editor may supportexecution highlighting, such that when the graphical program isexecuted, e.g., under control of the graphical programming developmentenvironment, the state oval corresponding to the currently active stateof the graphical program is visually highlighted in the state diagrameditor. The execution, control, and/or data flow of the graphicalprogram may be highlighted in parallel in the block diagram window ofthe graphical programming development environment.

State Diagram Information Including States which Specify Executable Code

In one embodiment of the invention, the state diagram information mayinclude information specifying executable code or source code, referredto below as program code, associated with one or more states. Forexample, when the user is using a state diagram editor to create a statediagram, when the user places a state in the state diagram, in oneembodiment the user may further specify program code for the state. Thisprogram code may then be used in the graphical program that is generatedbased on the state diagram. For example, the program code may specifyexecution instructions to be performed when the state is active and/ormay specify transition condition execution instructions.

In various embodiments, the program code associated with a state maycomprise any type of executable code or source code. For example, theprogram code may comprise a program module, such as a DLL or othershared library, JAVA class, etc. The program code may also include ormay be based on any combination of text-based and/or graphical sourcecode. If the program code is not graphical source code, then a “codeinterface” node may be included in the graphical program, wherein thecode interface node is operable to call the non-graphical source codeand link the non-graphical source code with the rest of the graphicalprogram. If the program code is graphical source code, then the programcode may be inserted into the block diagram of the generated graphicalprogram. In one embodiment, the program code may comprise a graphicalsub-program, which may appear in the block diagram as a single node. Forexample, in LabVIEW such a sub-program is referred to as a VI (VirtualInstrument).

In one embodiment, the state diagram editor may include or provide theuser with access to one or more state graphical program portions orstate “VIs”. These state graphical code portions or state VIs maycomprise states which inherently include a graphical code portion thatis executed when the state is entered in the state diagram. In anotherembodiment, the user may place a state in the state diagram using thestate diagram editor, and then may select program code to associate withthe state. For example, the user may select an icon representing theprogram code from a palette and drag-and-drop the icon onto a state inthe state diagram editor to associate the program code with the state,e.g., to specify that the program code executes when the state isentered in the graphical program. Thus, the user may use the statediagram editor to create a state diagram, and then may optionallyassociate program code with one or more of the states, e.g., by draggingand dropping icons onto the respective icons corresponding to thestates, by selecting program code modules using a dialog box, etc.

When the GPG program operates to programmatically generate a graphicalprogram, the GPG program may create a framework corresponding to thestate diagram and may further create executable graphical codecorresponding to the program code that is associated with the one ormore states. Thus, in this embodiment the GPG program is operable toprogrammatically create a more complete graphical program than isotherwise possible if no program code was associated with any of thestates in the state diagram. As one example, the user may associateprogram code with each of the states in the state diagram, and in thisexample the GPG program may be able to programmatically create acomplete working graphical program based on the state diagram.

In one embodiment, when the user associates program code with a state ina state diagram, the GPG program may operate to analyze the variousstates to which the respective state is connected and may use thisinformation in “connecting” the graphical code created corresponding tothis program code with the graphical code corresponding to the otherstates or with the graphical code created based on the program codeassociated with the other connecting states. Thus, the GPG program maytraverse the state diagram and utilize the connections to “tie in” orconnect the graphical program portion corresponding to the program codeof a respective state with its neighboring or connecting states. As oneexample of this operation, the program code associated with a state maybe a graphical sub-program or VI having specified inputs and outputs,e.g., the outputs may comprise an array of Boolean values. Each Booleanvalue in this array may be associated with a transition condition forthe state, and the Boolean values may determine the next state to beentered.

FIG. 20—GPG Program Accesses Server Program Through an API

As described above, in one embodiment, the GPG program may beimplemented as a client program and a server program, wherein the serverprogram may provide an application programming interface (API) which theclient program can use to programmatically generate the graphicalprogram. One embodiment of such a client/server implementation of a GPGprogram is described below.

For each node, programmatic structure, user interface element, or otherobject of the graphical program, the client program may call the API toprogrammatically add the object to the graphical program, connect theobject to other objects of the graphical program, etc. Any necessaryfiles or other constructs needed by the graphical programmingenvironment in order to use the generated graphical program may beautomatically created by the server program as a result of calling theAPI.

FIG. 20 is a block diagram illustrating the abstract relationshipbetween a client program 502, an API 504 to programmatically create/edita graphical program, and a server program 506. It is noted that the APIblock represents the abstract notion of the API presented by the serverprogram 506, and in various embodiments the API block 504 may notrepresent any actual code. Also, in actual embodiments, various layersmay exist which implement the elements of the FIG. 20 relationship. Forexample, the client program 502 may be a part of a larger softwareapplication, the server program 506 may receive information sent by theclient program 502 via an intermediate server, etc.

As noted above, the client program 502 may be any of various types ofprograms. For example, the client program 502 may be a graphicalprogram. The client program 502 may also be a text-based program such asa C++ program, a Visual Basic program, a JAVA program, etc., or anycombination of these or other languages. The client program 502 mayexecute independently or may execute within an execution subsystem of anapplication development environment.

The client program 502 may call the API 504 in any of various ways. Forexample, a client graphical program may include graphical nodescorresponding to the API 504. A client graphical program may alsointerface with text-based code which calls the API 504.

The client program 502 may also call the API 504 in various other ways.For example, the server program 506 may expose a component such as anActiveX component, CORBA component, JAVABEANS component, etc., and theclient program 502 may obtain a reference to the object to invokefunctions or methods of the API 504. The API 504 may also be integratedwith the language or development environment of the client program 502,e.g. as a library.

Through the API 504, the client program 502 may communicate with theserver program 506. The server program 506 is operable to perform theactions indicated by the API calls. For example, the server program maybe operable to create a new graphical program, add objects to thegraphical program, connect graphical program objects, etc. The serverprogram 506 is preferably an instance of a graphical programmingenvironment. In one embodiment, the server program 506 is an instance ofthe LabVIEW graphical programming environment.

As noted above, the GPG program may also be considered to be only theclient program 502, wherein in this instance the GPG program 502 simplyuses the services of a separate server program.

Graphical API

The server program 506 of FIG. 20 may be operable to receive requests togenerate/edit a graphical program from a client program 502 and performthe actual operations of creating/editing the graphical program. Thus,in the preferred embodiment, the client program 502 includes programlogic for processing received state diagram information and determiningthe structure of a graphical program to be generated based on thereceived state information, and the client program calls the serverprogram to perform the generation of the graphical program (or toperform a modification to an existing graphical program).

In one embodiment, the server program 506 of FIG. 20 is an applicationinstance of the LabVIEW graphical programming development environment.The LabVIEW environment provides specialized support for developers ofinstrumentation and industrial automation applications, and a LabVIEWgraphical program may be referred to as a virtual instrument or VI. TheLabVIEW environment comprises functionality referred to as “VI Server”which enables client programs to communicate with the LabVIEWenvironment. The VI Server functionality enables client programs tocreate or edit a LabVIEW graphical program or VI.

A client program which requests LabVIEW to generate/edit a VI may itselfbe a graphical program or VI. A client VI may include particular nodesin the client VI block diagram which utilize the VI Server functionalityof a LabVIEW instance to request the LabVIEW instance to obtaininformation of an existing VI, create a new VI, add objects to the VI,etc. These nodes and exemplary uses of the nodes are described in U.S.patent application Ser. No. 09/745,023, titled “System and Method forProgrammatically Generating a Graphical Program in Response to ProgramInformation”, which was incorporated by reference above. (LabVIEW alsoprovides components such as ActiveX components which enable text-basedprograms such as Visual Basic programs, Visual C++ programs, etc. toaccess the VI Server functionality. In the preferred embodiment, thesecomponents enable text-based client programs to perform all of the VIserver functions that graphical client programs can perform.)

Although the system and method of the present invention has beendescribed in connection with the preferred embodiment, it is notintended to be limited to the specific form set forth herein, but on thecontrary, it is intended to cover such alternatives, modifications, andequivalents, as can be reasonably included within the spirit and scopeof the invention as defined by the appended claims.

1. A computer-accessible memory medium storing program instructionsexecutable by a processor to: receive a first diagram, wherein the firstdiagram specifies one or more states and one or more transitions betweenthe states, wherein the first diagram specifies first functionality;store an extensible markup language (XML) representation based on thefirst diagram, wherein the XML representation specifies the firstfunctionality; and automatically generate a graphical data flow programbased on the XML representation, wherein the graphical data flow programspecifies a plurality of nodes and interconnections between the nodes,and wherein the graphical data flow program is executable by a processorto perform the first functionality.
 2. The memory medium of claim 1,wherein the program instructions are further executable to:automatically generate the XML representation based on the firstdiagram.
 3. The memory medium of claim 1, wherein the programinstructions are further executable to: display the graphical data flowprogram on a display after said automatically generating the graphicaldata flow program.
 4. The memory medium of claim 1, wherein the firstdiagram is a state diagram.
 5. The memory medium of claim 1, wherein,for at least one state of the one or more states, the first diagramcomprises program code associated with the at least one state; whereinthe graphical data flow program comprises the specified program code. 6.The memory medium of claim 1, wherein, for at least one state, the firstdiagram comprises program code associated with the state; wherein thegraphical data flow program is operable to invoke the specified programcode.
 7. The memory medium of claim 1, wherein the graphical data flowprogram comprises at least one placeholder for at least one statetransition of the one or more transitions.
 8. The memory medium of claim7, wherein the program instructions are further executable to: for theone or more state transitions, receive user input specifying a Booleancondition associated with each state transition.
 9. The memory medium ofclaim 1, wherein the plurality of nodes comprises at least a first nodethat represents control flow of data among one or more of the pluralityof nodes.
 10. The memory medium of claim 1, wherein the programinstructions are further executable to: automatically generate ahardware description based on the graphical data flow program, whereinthe hardware description specifies a hardware implementation of thegraphical data flow program, and wherein the hardware description isusable to configure a programmable hardware element to implement thefirst functionality.
 11. A method, comprising: receiving, by a computersystem, a first diagram, wherein the first diagram specifies one or morestates and one or more transitions between the states, wherein the firstdiagram specifies first functionality; automatically generating, by thecomputer system, an extensible markup language (XML) representationbased on the first diagram, wherein the XML representation specifies thefirst functionality; and automatically generating a data flow diagrambased on the XML representation, wherein the data flow diagram specifiesa plurality of nodes and interconnections between the nodes, and whereinthe data flow diagram is executable by a processor to perform the firstfunctionality.
 12. The method of claim 11, further comprising:displaying the data flow diagram on a display after said automaticallygenerating the data flow diagram.
 13. The method of claim 11, whereinthe first diagram is a state diagram.
 14. The method of claim 11,wherein, for at least one state of the one or more states, the firstdiagram comprises program code associated with the at least one state;wherein the data flow diagram comprises the specified program code. 15.The method of claim 11, wherein, for at least one state, the firstdiagram comprises program code associated with the state; wherein thedata flow diagram is operable to invoke the specified program code. 16.The method of claim 11, wherein the data flow diagram comprises at leastone placeholder for at least one state transition of the one or moretransitions.
 17. The method of claim 16, further comprising: for the oneor more state transitions, receiving user input specifying a Booleancondition associated with each state transition.
 18. The method of claim11, wherein the plurality of nodes comprises at least a first node thatrepresents control flow of data among one or more of the plurality ofnodes.
 19. The method of claim 11, further comprising: automaticallygenerating a hardware description based on the data flow diagram,wherein the hardware description specifies a hardware implementation ofthe data flow diagram, and wherein the hardware description is usable toconfigure a programmable hardware element to implement the firstfunctionality.
 20. A system, comprising: a processor; and a memorymedium coupled to the processor, wherein the memory medium storesprogram instructions executable by the processor to: receive a firstdiagram, wherein the first diagram specifies one or more states and oneor more transitions between the states, wherein the first diagramspecifies first functionality; store an extensible markup language (XML)representation based on the first diagram, wherein the XMLrepresentation specifies the first functionality; and automaticallygenerate a data flow program based on the XML representation, whereinthe data flow program specifies a plurality of nodes andinterconnections between the nodes, and wherein the data flow program isexecutable by a processor to perform the first functionality.
 21. Asystem, comprising: means for receiving a first diagram, wherein thefirst diagram specifies one or more states and one or more transitionsbetween the states, wherein the first diagram specifies firstfunctionality; means for automatically generating an extensible markuplanguage (XML) representation based on the first diagram, wherein theXML representation specifies the first functionality; and means forautomatically generating a data flow program based on the XMLrepresentation, wherein the data flow program specifies a plurality ofnodes and interconnections between the nodes, and wherein the data flowprogram is executable by a processor to perform the first functionality.